package com.easysoft.framework.action;

import com.easysoft.framework.beans.Page;
import com.easysoft.framework.casereply.model.SysCaseReplyQuery;
import com.easysoft.framework.casereply.model.SysCaseReplyView;
import com.easysoft.framework.casereply.service.SysCaseReplyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * 报案处理
 */
@RestController
@RequestMapping(value = SystemCaseReplyAction.BASE_VIEW)
public class SystemCaseReplyAction {
    public static final String BASE_VIEW = "/caseReply";
    private static final Logger logger = LoggerFactory.getLogger(SystemCaseReplyAction.class);

    @Autowired
    @Qualifier("service.SysCaseReplyService")
    private SysCaseReplyService sSysCaseReplyService;


    /**
     * 分页查询报案处理表
     * @param page  分页信息
     * @param query 查询条件
     * @return 报案处理表
     */
    @RequestMapping(value = "/listCaseReply", method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView listCaseReply(Page page, SysCaseReplyQuery query) {
        logger.info("Call SystemCaseReplyAction.listCaseReply({},{})", page.toString(), query.toString());
        List<SysCaseReplyView> list = sSysCaseReplyService.selectSysCaseReplyListByPage(query,page);
        ModelAndView mv = new ModelAndView(BASE_VIEW + "/listcasereply");
        mv.addObject("page", page);
        mv.addObject("query", query);
        mv.addObject("listCaseReply", list);
        return mv;
    }

}
